package com.web;

import com.pojo.JingXuan_x;
import com.service.JingXuanService_x;
import com.util.Result;
import com.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("jingxuan")
public class JingXuanController_x {
    @Autowired
    private JingXuanService_x jingXuanServiceX;
    @RequestMapping("select")
    public List<JingXuan_x> selectAll() {
        return jingXuanServiceX.selectAll();
    }
    @RequestMapping("show")
    public List<JingXuan_x> select1(){
        return jingXuanServiceX.select1();
    }

    @RequestMapping("/listid")
    public ResultEntity listById(Integer tId){
        return ResultEntity.ok(jingXuanServiceX.listById(tId));
    }

    @RequestMapping("add")
    Result add(JingXuan_x jingXuanX){
        return Result.ok(jingXuanServiceX.add(jingXuanX));
    }
    @RequestMapping("update")
    Result update(JingXuan_x jingXuanX){
        return Result.ok(jingXuanServiceX.update(jingXuanX));
    }
    @RequestMapping("delete")
    Result delete(Integer id){
        return Result.ok(jingXuanServiceX.delete(id));
    }
    @RequestMapping("/selectAll")
    public List<JingXuan_x> select(Integer id, String title) {
        return jingXuanServiceX.select(id, title);
    }
}
